package com.chuangsi.project.admin.controller.app;


import com.chuangsi.framework.web.controller.BaseController;
import com.chuangsi.framework.web.domain.ResultObject;
import com.chuangsi.framework.web.page.TableDataInfo;
import com.chuangsi.project.admin.dto.admin.defeat.ReqDefeatPageDto;
import com.chuangsi.project.admin.dto.admin.defeat.ResDefeatPageDto;
import com.chuangsi.project.admin.dto.admin.defeat.app.ReqDefeadAddDto;
import com.chuangsi.project.admin.service.DefeatService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 战败记录 前端控制器
 * </p>
 *
 * @author 
 * @since 2024-05-10
 */
@Api(tags="APP-战败记录")
@RestController
@RequestMapping("/userApi/defeat/app")
public class AppDefeatController extends BaseController {

    @Autowired
    private DefeatService defeatService;


    @ApiOperation(value = "分页查询",notes = "ywb")
    @GetMapping("/pageQuery")
    public TableDataInfo<ResDefeatPageDto> appPageQuery(ReqDefeatPageDto dto){
        startPage();
        List<ResDefeatPageDto> page = defeatService.appPageQuery(dto);
        return getDataTable(page);
    }

    @ApiOperation(value = "添加战败", notes = "ywb")
    @PostMapping("/addDefeat")
    public ResultObject<Void> addDefeat(@RequestBody @Validated ReqDefeadAddDto req) {
        defeatService.addDefeat(req);
        return ResultObject.ok("添加成功");
    }


}
